package com.example.ktlib

class MyClass {

}

fun main() {

    //返回最后一行
    val let: Int = "Hello".let {
        it.length
    }

    //返回最后一行,持有this
    val run: Int = "Hello".run {
        length
    }

    val apply: String = "Hello".apply {
        println(this.length)
        length
    }
    val also: String = "Hello".also {
        it.length
        println(it.length)
    }

    val takeIf: String? = "Hello".takeIf {
        it.length > 6
    }

    val takeUnless: String? = "Hello".takeUnless {
        it.length > 6
    }

}